//中文
var data_zh = ['你知道吗', '六月', '一日', '星期一', '是', '儿童节'];
//英语
var data_en = ['do you know', 'June', 'One day', 'Monday', 'Yes', 'Children\'s day'];
var data = ['你知道吗', '六月', '一日', '星期一', '是', '儿童节', 'do you know', 'June', 'One day', 'Monday', 'Yes', 'Children\'s day']

function up() {
    var one = document.querySelector("#one").value;
    one = String(one);
    //    console.log(one);
    for (var i = 0; i < data_zh.length; i++) {
        //        console.log(data_zh[i]);
        if (one == data_zh[i]) {
            document.querySelector("#two").value = data_en[i];
            document.querySelector(".color1").style.color = "black";
            document.querySelector(".color3").style.color = "black";
            document.querySelector(".color").style.color = "white";
            document.querySelector(".color2").style.color = "white";
            document.querySelector(".color1").style.background = "white";
            document.querySelector(".color3").style.background = "white";
            document.querySelector(".color").style.background = "#8290f8";
            document.querySelector(".color2").style.background = "#8290f8";
        }
        else if (one == data_en[i]) {
            document.querySelector("#two").value = data_zh[i];
            document.querySelector(".color").style.color = "black";
            document.querySelector(".color2").style.color = "black";
            document.querySelector(".color1").style.color = "white";
            document.querySelector(".color3").style.color = "white";
            document.querySelector(".color").style.background = "white";
            document.querySelector(".color2").style.background = "white";
            document.querySelector(".color1").style.background = "#8290f8";
            document.querySelector(".color3").style.background = "#8290f8";
        }
        
    }
    if(data.indexOf(one)==-1){
            alert("无法识别，能力有限");
        document.querySelector("#two").value =" ";
        }
}
var k = 1

function switchLan(n) {
    k++;
    if (k == 3) {
        k = 1;
    }
     var one = document.querySelector("#one").value;
    one = String(one);
     var two = document.querySelector("#two").value;
    two = String(two);
    if (k == 1) {
//        console.log(two);
        document.querySelector("#two").value=one;
        document.querySelector("#one").value=two;
        document.querySelector(".color1").style.color = "black";
        document.querySelector(".color3").style.color = "black";
        document.querySelector(".color").style.color = "white";
        document.querySelector(".color2").style.color = "white";
        document.querySelector(".color1").style.background = "white";
        document.querySelector(".color3").style.background = "white";
        document.querySelector(".color").style.background = "#8290f8";
        document.querySelector(".color2").style.background = "#8290f8";
    }
    else if (k == 2) {
//        console.log(one); 
        document.querySelector("#one").value=two;
        document.querySelector("#two").value=one;
        document.querySelector(".color").style.color = "black";
        document.querySelector(".color2").style.color = "black";
        document.querySelector(".color1").style.color = "white";
        document.querySelector(".color3").style.color = "white";
        document.querySelector(".color").style.background = "white";
        document.querySelector(".color2").style.background = "white";
        document.querySelector(".color1").style.background = "#8290f8";
        document.querySelector(".color3").style.background = "#8290f8";
    }
}